package org.jeecg.modules.demo.jxcx.controller;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.modules.demo.jxcx.Utils.R;
import org.jeecg.modules.demo.jxcx.po.JxcZfzd;
import org.jeecg.modules.demo.jxcx.service.JxcZfzdService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping({"jxcZfzd"})
public class JxcZfzdController {
    private static Logger logger = LoggerFactory.getLogger(JxcZfzdController.class);
    @Autowired
    private JxcZfzdService jxcZfzdService;


    @PostMapping({"/queryall"})
    @ResponseBody
    public R queryall(@RequestBody JSONObject params) {
        String companyId = params.getString("companyId");
        String id = params.getString("id");
        return new R().ok(jxcZfzdService.getByCompanyId(companyId,id));
    }

    @PostMapping({"add"})
    public R insert(@RequestBody JxcZfzd jxcZfzd) {
        return jxcZfzdService.add(jxcZfzd);
    }
    @PutMapping
    public R update(@RequestBody JxcZfzd jxcZfzd) {
//        if (jxcZfzd.getQmurl() == null || jxcZfzd.getQmurl().equals("")){
//            return new R().error("请设置签章");
//        }
        return new R().ok(jxcZfzdService.updateById(jxcZfzd));
    }
}
